// reducer 函数模块  根据旧的state 和 指定的state 返回同一个新的 state
// 管理count状态的 reducer   reducer 定义方法 修改 store 里面的状态 
import {INCREMENT,DECREMENT } from './action-types'
import { combineReducers} from '../lib/redux'
function count(state=2,action){
    console.log('reducer',state,action);   // 1 {type:INCREMENT,}
    switch(action.type){
       case INCREMENT:
           return state + action.data
       case DECREMENT:
           return state - action.data
        default:
            return state;
    }
}

function user(state={},action){
   switch(action.type){
    default:
        return state;
   }
}

export default combineReducers({
    count,
    user
})

